<template>
  <section>
    <el-tabs v-model="activeName" type="card" @tab-click="handleClick">
      <el-tab-pane v-for="(item,index) in acList" :label="item.label" :name="item.name" :key="index"></el-tab-pane>
      <!-- <el-tab-pane label="消费记录" name="record"></el-tab-pane> -->
    </el-tabs>
    <div>
      <comm v-if="active" :is="activeName" :detail="detail"></comm>
    </div>
  </section>
</template>
<script>  
export default {
  name: "chargeIndex",
  data() {
    return {
      activeName: "pay",
      acList: [
        {
          label: "待付费",
          name: "pay"
        },
        {
          label: "待支付",
          name: "payment"
        },{
          label: "已收费",
          name: "overpay"
        },{
          label:"已退费",
          name:"sof"
        }
        // ,{
        //   label:"挂账记录",
        //   name:"account"
        // }
      ],
      active: false,
      detail: ""
    };
  },
  created() {},
  mounted() {
    let th = this;
    th.active = true;
    let type=th.$route.query.type;
    if(type){
       switch(parseInt(type)){
         case 0:
           th.activeName="pay";
           break;
         case 1:
           th.activeName="payment";
           break;
        case 2:
           th.activeName="overpay";
           break;
         case 3:
           th.activeName="sof";
           break;
        default:
           th.activeName="account";
           break;     
       }
    }
  },
  methods: {
    handleClick(tab, event) {
       let th=this;
       let j={
         type:tab.index
       }
      th.$router.push({
        path: '/page/chargeIndex',
        query: th.getUrlToken(j)
      });
    }
  },
  components: { 
    pay: () => import("./_child/pay"),
    payment: () => import("./_child/payment"),
    overpay: () => import("./_child/overpay"),
    sof:() => import("./_child/sof"),
    account:() => import("./_child/account"),
  }
};
</script>
<style lang="scss" scoped>
</style>

